<?php
// json_decode(Option::where("option_name","rule_goods")->first(["option_value"])->option_value)->rule;
// 以指定值 为数组的键
function key_val($arr, $str='id')
{
    $temp_key_info = array_column($arr,$str);  // 键值
    $arr = array_combine($temp_key_info,$arr) ;
    return $arr;
}
//生成订单号
function GenericOrderCode($userid){
    if(empty($userid)){
        //匿名订单?
        $userid = 0;
    }
    $userid = sprintf('%06s', $userid);
    $date = new \DateTime;
    return $date->format('YmdHisu').$userid;
}